﻿using EFCore3.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore3.EntityConfig
{
    public class TeacherConfig:IEntityTypeConfiguration<Teacher>
    {
        public void Configure(EntityTypeBuilder<Teacher> builder)
        {
            builder.ToTable("T_Teacher").HasKey(p => p.Id);
            builder.HasMany(p => p.Students).WithMany(p => p.Teachers).UsingEntity(p => p.ToTable("TS_Relation"));

        }

    }
}
